//
// Created by Semir on 2020/4/23.
//

#include <iostream>
#include <map>
#include <string>
#include <algorithm>

using namespace std;

map<string, int> table = {{"one", 1}, {"two", 2}, {"three", 3}, {"four", 4},
                          {"five", 5}, {"six", 6}, {"seven", 7}, {"eight", 8},
                          {"nine", 9}, {"ten", 10}, {"eleven", 11}, {"twelve", 12},
                          {"thirteen", 13}, {"fourteen", 14}, {"fifteen", 15}, {"sixteen", 16},
                          {"seventeen", 17}, {"eighteen", 18}, {"nineteen", 19}, {"twenty", 20},
                          {"a", 1}, {"both", 2}, {"another", 1}, {"first", 1},
                          {"second", 2}, {"third", 3}};
string words[7];
int arr[7];

int main() {
    int len = 0;
    for (int i = 1; i <= 6; i++) {
        cin >> words[i];
        if (table.count(words[i]) != 0) {
            len++;
            int val = table[words[i]] * table[words[i]] % 100;
            arr[len] = val;
        }
    }
    sort(arr + 1, arr + len + 1);
    if (len == 0) {
        cout << "0";
        return 0;
    }
    cout << arr[1];
    for (int i = 2; i <= len; i++) {
        if (arr[i] < 10) {
            cout << "0";
        }
        cout << arr[i];
    }
    return 0;
}